export default {
	name: "blind-box", // 盲盒
	data() {
		return {
			prizeList: []
		};
	},
	created() {
		this.updateDrawList()
	},
	watch: {
		pid(value) {
			this.updateDrawList()
		},
	},
	methods: {
		updateDrawList() {
			this.prizeList = this.drawList
		},
		handleDrawStart() {
			if (!!this.prizeing) return
			this.prizeing = true;
			const {
				prizeList
			} = this;
				this.currentIndex = this.eggIndex + 1;
				this.prizeing = false
				//  模拟调用接口获取数据
				const info = {
					"id": "0b8a58e7-8f4a-4cd9-bbd4-78406f4e4287",
					"prizeType": 1,
					"batchProduct": "60100002180",
					"prizeName": "30元立减金",
					"prizeImageUrl": "https://fulu-mall.oss-cn-hangzhou.aliyuncs.com/e01a6b01fbd641ae99249ea09622e568.png",
					"prizeImageType": "2",
					"sort": 1
				}
				this.draw(info);
				//
				setTimeout(() => {
					this.currentIndex = 0;
				}, 1000);
		},
		resetDraw() {
			// 展示弹窗
			this.$emit('showPrizeModal');
			// 旋转结束后，开始处理拿到结果后的逻辑
			this.prizeing = false;
		},
		draw(info) { // 抽奖
			const {
				boxList
			} = this
			let that = this;
			clearInterval(that.mysteryTimer);
			this.mysteryTimer = null;
			that.currentIndex = 0;
			that.currentSelect = info.sort;
			this.resetDraw()
		},
	}
}